<template>
  <modal @close_modal="close" :default_dialog="true">
    <div class="re_container">
      <p class="title md_m_font color_ec" v-if="type === 'share'">
        恭喜你<br/>
        获得一笔分享奖励金
        <span v-show="state" class="sm_font color_gray_03">(待入账)</span>
      </p>
      <p class="title md_m_font color_ec" v-if="type === 'use'">
        恭喜你<br/>
        获得{{nums}}笔使用奖励金
      </p>
      <p class="awardRemind">
        <span class="lg_s_font color_red"><b class="sm_font">￥</b>{{money || 0}}<i class="sm_font">元</i></span>
        <span class="sm_font color_ec">总计</span>
      </p>
      <p v-show="stateUnder" class="color_red" style="position: relative;top: -2.5rem;font-size: 1.4rem;">{{moneyUnder1}}+{{moneyUnder2}}</p>
      <p class="btn md_s_font" @click="OK_btn">知道啦，退下吧</p>
      <p class="md_s_font color_gray" v-if="type !== 'use'">分享奖励金已放入您的钱包</p>
      <p class="md_s_font color_gray" v-if="type === 'use'">使用奖励金已放入您的钱包</p>
      <p v-if="!returnHistory" class="sm_font color_ec money_bag_btn" @click="wallet">查看钱包</p>
      <p v-if="returnHistory" class="sm_font color_ec money_bag_btn" @click="wallet_return">查看钱包</p>
    </div>
  </modal>
</template>

<script>
export default {
  name: 'reward-modal',
  props: {
    money: {
      type: [String, Number]
    },
    moneyUnder1:{
    	 type: [String, Number]
    },
    moneyUnder2:{
    	 type: [String, Number]
    },
    nums: {
      type: [String, Number],
      default: 1
    },
    state: {
      type: Boolean
    },
    stateUnder:{
    	type: Boolean
    },
    defaultVal: {
      type: Boolean,
      default: false
    },
    type: {
      type: String,
      default: 'share'
    },
    returnHistory:{ //邮寄提交订单后钱包明细返回问题
    	type: Boolean
    }
  },
  methods: {
    close() {
      this.$emit("close")
    },
    wallet(e) {
    	 var ev = e || window.event;
    	 if( ev.stopPropagation ){
        ev.stopPropagation(); // 普通浏览器阻止冒泡
    }else{
        ev.cancelBubble = true;  // IE 阻止冒泡
    }
    	this.$router.push({path: '/wallet',query:{
    		returnHistory:true
    	}})

    },
    wallet_return(e){
    	 var ev = e || window.event;
    	 if( ev.stopPropagation ){
        ev.stopPropagation(); // 普通浏览器阻止冒泡
    }else{
        ev.cancelBubble = true;  // IE 阻止冒泡
    }
    	this.$router.push({path: '/wallet',query:{
    		returnHistory:true
    	}})
    },
    OK_btn() {
      if (this.defaultVal) {
        this.$emit('OK_btn')
      } else {
        this.close()
      }
    }
  }
}
</script>

<style lang="css" scoped>
@import 'style.css';
.awardRemind {
  background: url('../../../images/useReward.png') no-repeat center;
}
</style>
